<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"  xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
	<div class="wrapper wrapper-content">
		<div class="row">
			<div class="col-sm-12">
				<div class="ibox float-e-margins">
					<div class="ibox-content">
						<form class="form-horizontal m-t" id="signupForm">
							<input id="parentId" name="parentId" type="hidden" th:value="${parentId}">
							<input type="hidden" th:value="${flag}" id="flag" name="flag">
							<input type="hidden" th:value="${teamFlag}" id="teamFlag" name="teamFlag">
							<div class="form-group">
								<label class="col-sm-3 control-label">邮费类型：</label>
								<div class="col-sm-8">

									<label class="radio-inline">
                                        <input type="radio" name="calculatetype" value="0"
											   onchange ="Change()"/> 按重量
									</label>

									<label class="radio-inline">
										<input type="radio" name="calculatetype" value="1"
											   onchange ="Change()"/> 按件
									</label>
<!--                                    <label class="radio-inline">-->
<!--                                        <input type="radio" name="calculatetype" value="2" /> 包邮-->
<!--                                    </label>-->
<!--                                    <label class="radio-inline">-->
<!--                                        <input type="radio" name="calculatetype" value="3" /> 通用-->
<!--									</label>-->
<!--                                    <label class="radio-inline">-->
<!--                                        <input type="radio" name="calculatetype" value="4" /> 距离-->
<!--                                    </label>-->
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">*选择商户：</label>
								<div class="col-sm-8">
									<select data-placeholder="商户" class="form-control chosen-select" name="centreId" tabindex="2"  id="centreId"
											onchange="getCentreTeamList(this)">
										<option value="0"  th:if="${flag} == '0'">选择商户</option>
										<option th:each="item: ${centreList}" th:text="${item.name}" th:value="${item.centreId}"></option>
									</select>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">*选择门店：</label>
								<div class="col-sm-8">
									<select data-placeholder="门店" class="form-control chosen-select" name="teamId" tabindex="2"  id="teamId">
										<option value="0" th:if="${teamFlag} == '0'">选择门店</option>
										<option th:each="item: ${teamList}"  th:if="${flag} == '1'"  th:text="${item.tXiaoqu}" th:value="${item.teamid}"></option>
									</select>
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">模板名称：</label>
								<div class="col-sm-8">
									<input id="dispatchname" name="dispatchname" class="form-control" type="text">
								</div>
							</div>

							<div id="height" style="display: none">
							<div class="form-group">
								<label class="col-sm-3 control-label">首重邮费：</label>
								<div class="col-sm-8">
									<input id="firstprice" name="firstprice" class="form-control" type="number" min="0">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">续重邮费：</label>
								<div class="col-sm-8">
									<input id="secondprice" name="secondprice" class="form-control" type="number" min="0">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">首重：</label>
								<div class="col-sm-8">
									<input id="firstweight" name="firstweight" class="form-control" type="number" min="0">
								</div>
							</div>

							<div class="form-group">
								<label class="col-sm-3 control-label">续重：</label>
								<div class="col-sm-8">
									<input id="secondweight" name="secondweight" class="form-control" type="number" min="0">
								</div>
							</div>
							</div>

							<div id="num" style="display: none">
							<div class="form-group">
								<label class="col-sm-3 control-label">首档邮费：</label>
								<div class="col-sm-8">
									<input id="firstnumprice" name="firstnumprice" class="form-control" type="number" min="0">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">续档邮费：</label>
								<div class="col-sm-8">
									<input id="secondnumprice" name="secondnumprice" class="form-control" type="number" min="0">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">首档数量：</label>
								<div class="col-sm-8">
									<input id="firstnum" name="firstnum" class="form-control" type="number" min="0">
								</div>
							</div>
							<div class="form-group">
								<label class="col-sm-3 control-label">续档数量：</label>
								<div class="col-sm-8">
									<input id="secondnum" name="secondnum" class="form-control" type="number" min="0">
								</div>
							</div>
							</div>

							<div class="form-group text-center">
								<div class="col-sm-8 col-sm-offset-2">
									<button type="submit" class="btn btn-primary"><i class="fa fa-check"></i>提交</button>
									<div class="btn btn-danger" onclick="closeDow()"><i class="fa fa-remove"></i> 关闭</div>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
	<div th:include="include::footer"></div>
	<script src="/js/appjs/platform/add.js"></script>
	<script type="text/javascript">
		function closeDow() {
			var index = parent.layer.getFrameIndex(window.name); // 获取窗口索引
			parent.layer.close(index);
		}

        function getCentreTeamList(obj) {
            var index = obj.options[obj.selectedIndex].value;
            var html = "";
            if (index == 0) {
                // $("#teamId").html(html);
            } else {
                $.ajax({
                    url: "/commander/manage/getTeamList?centreId=" + index,
                    dataType: "json",
                    success: function (data) {
                        for (var i = 0; i < data.length; i++) {
                            //<!--<option th:each="item: ${teamList}" th:text="${item.tXiaoqu}" th:value="${item.teamid}"></option>-->
                            html += '<option value="' + data[i].teamid + '">' + data[i].tXiaoqu + '</option>';
                        }
                        $("#teamId").html(html);
                    }
                })
            }
        }
	</script>
</body>

</html>
